package com.why.simpleboot.core.core.schedule.Task;

import com.why.simpleboot.core.common.utils.SimpleReflectUtils;

import java.lang.reflect.Method;

/**
 * @program: why-simpleboot-framework
 * @description:
 * @author: @why
 * @create: 2021-05-29 16:25
 **/
public class FunctionTask extends ScheduleTask implements Runnable {
    private Method method;
    private Object target;
    private Object[] args;
    public FunctionTask(Method method, Object target, Object[] args, TaskType taskType) {
        super(taskType);
        this.method = method;
        this.target = target;
        this.args = args;

    }

    @Override
    public void run() {
        SimpleReflectUtils.invokeMethodNoResult(target, method, args);
    }

    public Method getMethod() {
        return method;
    }

    public Object getTarget() {
        return target;
    }

    public Object[] getArgs() {
        return args;
    }
}
